Skip to content

NO TICKET: cascade delete for field_activity in Sample model#315

Merged
jirhiker merged 1 commit into
stagingfrom
sample-field-activity-fix
Dec 23, 2025
Merged

NO TICKET: cascade delete for field_activity in Sample model#315
jirhiker merged 1 commit into
stagingfrom
sample-field-activity-fix

Conversation

@jacob-a-brown

Copy link
Copy Markdown
Contributor

Why

This PR addresses the following problem / context:

  • a Sample record should not exist without FieldEvent or FieldActivity records.

How

Implementation summary - the following was changed / added / removed:

  • Added ondelete="CASCADE" to the field_activity_id foreign key defined in Sample model. Deleting a FieldEvent cascades to deleting a FieldActivity, which cascades to deleting the Sample. If just a FieldActivity is deleted then the Sample will still be deleted.

Notes

Any special considerations, workarounds, or follow-up work to note?

  • Use bullet points here

We can't have a `Sample` referencing a deleted `FieldActivity`. This change adds
`ondelete="CASCADE"` to the foreign key definition and updates the relationship to
handle cascading deletes properly.
@codecov-commenter

codecov-commenter commented Dec 22, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Files with missing lines Coverage Δ
db/sample.py 100.00% <ø> (ø)

... and 1 file with indirect coverage changes

@jirhiker jirhiker merged commit 3be017e into staging Dec 23, 2025
6 checks passed
@TylerAdamMartinez TylerAdamMartinez deleted the sample-field-activity-fix branch February 26, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants